<template>
  <div>
    <ZgDialog :title="'导入港口月度计划'" v-model="visible" @ok="onAdd">
      <ZgUpFile :accept="currAttAccept" v-model="fileList"></ZgUpFile>
    </ZgDialog>
  </div>
</template>
<script>
export default {
  data () {
    return {
      visible: false,
      obj: null,
      currAttAccept: '.txt,.doc,.docx,.xls,.xlsx,.ppt,.pptx,.pdf,mp3,mp4,.zip,.rar,.png,.jpg,.jpeg,.gif',
      fileList: []
    }
  },
  methods: {
    open (json) {
      this.obj = Object.assign({}, this.obj, json || {})
      this.visible = true
    },
    onAdd () {
        const arr = this.fileList.filter(t => {
            return t.path && t.path.length > 0
        })
        if (arr.length === 0) {
            this.$error({ title: '请上传文件' })
            return
        }
        this.$emit('ok')
        // const param = arr.map(t => {
        //     return {
        //     code: this.currAttType,
        //     fileName: t.name,
        //     fileSize: t.size,
        //     filePath: t.path,
        //     tableName: this.tableName,
        //     tableId: this.dataId
        //     }
        // })
        // this.$http.post('/zg-system/attach/add', param, () => {
        //     this.showAdd = false
        //     this.$refs.page.search()
        // })
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
